package com.cy.lib.redis.util;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;

public class SpringUtils {
	
	public static ClassPathXmlApplicationContext context = null;
	
	public static ClassPathXmlApplicationContext init(){
		if(context ==null){
			context = new ClassPathXmlApplicationContext("classpath*:ApplicationContext.xml");
			context.start();
		}
		return context;
	}
	
	public static RedisTemplate getRedisTemplate(){
		if(context ==null)
			init();
		return context.getBean(RedisTemplate.class);
	}
}
